/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "tipo_vivienda_entorno", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "TipoViviendaEntorno.findAll", query = "SELECT t FROM TipoViviendaEntorno t"),
    @NamedQuery(name = "TipoViviendaEntorno.findByIdTipoViviendaEntorno", query = "SELECT t FROM TipoViviendaEntorno t WHERE t.idTipoViviendaEntorno = :idTipoViviendaEntorno"),
    @NamedQuery(name = "TipoViviendaEntorno.findByTveNombre", query = "SELECT t FROM TipoViviendaEntorno t WHERE t.tveNombre = :tveNombre")})
public class HousingEnvironmentType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_tipo_vivienda_entorno")
    private Integer id;
    @Column(name = "tve_nombre")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "housingEnvironmentType")
    private List<HousingEnvironmentName> housingEnvironmentNames;

    public HousingEnvironmentType() {
    }

    public HousingEnvironmentType(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<HousingEnvironmentName> getHousingEnvironmentNames() {
        return housingEnvironmentNames;
    }

    public void setHousingEnvironmentNames(List<HousingEnvironmentName> housingEnvironmentNames) {
        this.housingEnvironmentNames = housingEnvironmentNames;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HousingEnvironmentType)) {
            return false;
        }
        HousingEnvironmentType other = (HousingEnvironmentType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.HousingEnvironmentType[ id=" + id + " ]";
    }
    
}
